<?php

require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once(dirname(__FILE__).'/../../init.php');


$fname        = htmlspecialchars(trim($_POST['prodids'][0]));  
$fname1        = htmlspecialchars(trim($_POST['selprodids'][0]));  


$productids=array();
$productids=$_POST['prodids'];
$buywithids=$_POST['selprodids'];
$no_of_products=2;
$i=0;
Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
    
                truncate table ' . _DB_PREFIX_ . 'discoicons');

foreach ($productids as $productid) {
    $buywith='';
    $buywith=$productid.',';
    for($index=0;$index<$no_of_products;$index++)
    {
        $buywith=$buywith.'"'.$buywithids[$i][$index].'",';
    }
    $i++;
    $buywith=substr($buywith, 0, strlen($buywith)-1);

 Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
    
                INSERT INTO ' . _DB_PREFIX_ . 'discoicons
                VALUES('.$buywith.')');
}



?>
